void main (){
  // 准备购物车数据
  List carts = [
    {"count": 2, "price": 10.0, "selected": false},
    {"count": 1, "price": 30.0, "selected": false},
    {"count": 5, "price": 20.0, "selected": true}
  ];
  
  double totalPrice = 0;

  carts.forEach((item) {
    if (item['selected']) {
      totalPrice += item['count'] * item['price'];
    }
  });

  // for (var item in carts) {
  //   if (item['selected'] == true) {
  //     totalPrice += item['count'] * item['price'];
  //   }
  // }
  print('总价格为:$totalPrice');


}